
// function load () {
//   return new Promise((resolve, reject) => {
//     // resolve(true)
//     console.log('傻逼')
//     reject(new Error('111'))
//     console.log('傻逼2')
//   })
// }

// load().then(res => console.log(res)).catch((e) => console.log(e))

var user = {
  name: 'zs',
  age: 11,
  addr: {
    area: '武汉',
    house: 'xxx社区',
  },
  friends: ['路人甲', '路人乙', '路人丙'],
}

function clone (u) {
  var obj = {}
  for (const key in u) {
    if (typeof u[key] === 'object') {
      obj[key] = clone(u[key])
    } else {
      obj[key] = u[key]
    }
  }
  return obj
}

var user1 = clone(user)

user1.age = 20
user1.addr.house = '别墅'
console.log('user1', user1)

console.log('user', user)

var obj1 = {
  value: '111',
}

var obj2 = {
  value: '222',
}

var obj = obj1
obj = obj2
obj = 3
console.log('obj', obj)
